package com.qf.dao.Impl;

import com.qf.dao.UserDao;
import com.qf.entity.StuInfo;
import com.qf.util.DatasoureUtil;
import org.apache.commons.dbutils.QueryRunner;
import org.apache.commons.dbutils.handlers.BeanHandler;

import java.sql.Connection;
import java.sql.SQLException;

/**
 * @author a1275872671
 * @version v1.0
 * @project guanqipeng
 * @package com.qf.dao.Impl
 * @company
 * @date 2024/4/30 09:43
 */
public class UserDaoImpl implements UserDao {
    private QueryRunner qr=new QueryRunner(DatasoureUtil.getDataSource());
    @Override
    public StuInfo select(String shuno, String pwd) {
        String sql="select * from stulnfo where shuno=? and pwd=?";
        try {
            return qr.query(sql,new BeanHandler<>(StuInfo.class),shuno,pwd);
        } catch (SQLException e) {
            throw new RuntimeException(e);
        }
    }
}
